import mongoose, { Document, Schema } from 'mongoose'

export interface IGift extends Document {
  name: string
  description: string
  price: number
  icon: string
  animation: string
  type: 'normal' | 'special' | 'super'
  duration: number
  createdAt: Date
  updatedAt: Date
}

const GiftSchema = new Schema(
  {
    name: { type: String, required: true },
    description: { type: String },
    price: { type: Number, required: true },
    icon: { type: String, required: true },
    animation: { type: String },
    type: { type: String, enum: ['normal', 'special', 'super'], default: 'normal' },
    duration: { type: Number, default: 3000 }, // 动画持续时间（毫秒）
  },
  {
    timestamps: true,
  }
)

export const Gift = mongoose.model<IGift>('Gift', GiftSchema)
